<?php

namespace app\controller;

use app\extend\mylog\LogFacade;
use app\extend\mylog\MyLogDriver;
use app\Request;
use app\service\LoginService;
use app\util\Utils;
use think\Log;

class Login extends Base
{

    private $loginService;
    public function __construct()
    {
        $this->loginService = new LoginService();
//        $logDriver = new MyLogDriver("test1.log");
        //LogFacade::info();
//        (new Log())->info();
//        \think\facade\Log::info();
    }

    public function login(Request $request){
        $req = $request->post();
        //print_r($req);exit();
        $phone = $req['phone'];
        if (Utils::isPoneLandline($phone)){
        $phone = $req['phone'];
        $pwd = $req['pwd'];
            $rut =$this->loginService->login($phone,$pwd);
            return $this->Success($rut);
        }else{
            return $this->Error('手机格式有问题');
        }
    }

    public function test(){
        return 'token检验';
    }

}